package com.huawei.hianalytics.log.g;

import android.os.Handler;
import com.huawei.hianalytics.a.d;
import com.huawei.hianalytics.log.b.a.a;
import com.huawei.hianalytics.log.e.f;
import com.huawei.hianalytics.log.f.c;
import java.io.File;
import java.util.Arrays;

public class b implements e {
    private String a;
    private String b;
    private String c;
    private Handler d;

    public b(String str, Handler handler, String str2) {
        this.a = str;
        this.d = handler;
        this.b = str2 + a.b;
        this.c = str2 + a.c;
    }

    public void run() {
        if (f.a(this.c)) {
            c bVar = new com.huawei.hianalytics.log.f.b();
            com.huawei.hianalytics.log.f.a.a(this.b, d.f() + 1);
            if (!bVar.a(this.b, this.a, this.c)) {
                com.huawei.hianalytics.g.b.d("CreateFirstZip", "log create zip fail");
            }
            File[] a = com.huawei.hianalytics.log.f.a.a(this.c);
            if (a == null) {
                com.huawei.hianalytics.g.b.b("CreateFirstZip", "get zipFiles(): zipFiles is null");
                return;
            }
            int length = a.length;
            if (length == 0) {
                com.huawei.hianalytics.g.b.c("CreateFirstZip", "There is no file in zips, do not carry out the report");
                return;
            }
            if (length > d.g() && f.b(a) > d.g()) {
                a = com.huawei.hianalytics.log.f.a.a(this.c);
                Arrays.sort(a, new com.huawei.hianalytics.log.f.a.a());
                com.huawei.hianalytics.log.f.a.a(a, d.g());
            }
            this.d.sendEmptyMessageDelayed(6, 2000);
            return;
        }
        com.huawei.hianalytics.g.b.d("CreateFirstZip", "file create fail");
    }
}
